The Unsupervised Learning Workshop by AARON JONES CHRISTOPHER KRUGER
 BENJAMIN JOHNSTON

The Unsupervised Learning Workshop by AARON JONES CHRISTOPHER KRUGER
 BENJAMIN JOHNSTON

Author:AARON JONES, CHRISTOPHER KRUGER
, BENJAMIN JOHNSTON
Language: eng
Format: epub
Publisher: Packt Publishing Pvt. Ltd.
Published: 2020-07-28T00:00:00+00:00


Activity 6.02: t-SNE Wine and Perplexity

In this activity, we will use the Wine dataset to further reinforce the influence of perplexity on the t-SNE visualization process. In this activity, we will try to determine whether we can identify the source of the wine based on its chemical composition. The t-SNE process provides an effective means of representing and possibly identifying the sources.

Note

This dataset is sourced from https://archive.ics.uci.edu/ml/machine-learning-databases/wine/ (UCI Machine Learning Repository [http://archive.ics.uci.edu/ml]. Irvine, CA: University of California, School of Information and Computer Science). It can be downloaded from https://packt.live/3aPOmRJ.

Import pandas, numpy, and matplotlib, as well as the t-SNE and PCA models from scikit-learn.

Load the Wine dataset and inspect the first five rows.

The first column provides the labels; extract these from the DataFrame and store them in a separate variable. Ensure that the column is removed from the DataFrame.

Execute PCA on the dataset and extract the first six components.

Construct a loop that iterates through the perplexity values (1, 5, 20, 30, 80, 160, 320). For each loop, generate a t-SNE model with the corresponding perplexity and print a scatter plot of the labeled wine classes. Note the effect of different perplexity values.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.